package com.wh1200.mybatis.xmlless.config

import com.wh1200.xmlless.test.dao.RoleDAO
import com.wh1200.xmlless.test.model.Role
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import kotlin.reflect.jvm.javaMethod
import kotlin.test.assertContains
import kotlin.test.assertNotNull


/**
 *
 * Created by 吴昊 on 2018-12-09.
 *
 * @author 吴昊
 * @since 0.0.1
 */
class RoleDAOResolverTest : BaseResolverTest(
    RoleDAO::class.java
) {

  @Test
  @DisplayName("测试逻辑删除的字段类型为String, delete方法")
  fun testLogicDelete() {
    val query = createQueryForMethod(RoleDAO::deleteById.javaMethod!!)
    val sql = query.sql
    assertNotNull(sql)
    assertContains(sql, "del_flag = '2'")
  }

  @Test
  @DisplayName("测试逻辑删除的字段类型为String，find方法")
  fun testLogicDelete2() {
    val query = createQueryForMethod(RoleDAO::findById.javaMethod!!)
    val sql = query.sql
    assertNotNull(sql)
    assertContains(sql, "del_flag = '0'")
  }

}
